<?php

namespace IDock\Insurance\ZSIC\Request;

use Exception;
use IDock\Insurance\ZSIC\Request\AllZSICRequest;
use IDock\Insurance\ZSIC\Response\NonCarProductListResponse;
use IDock\Insurance\ZSIC\Response\VehicleModelResponse;
use IDock\Insurance\ZSIC\ZSICEnums;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\Premium\PremiumChargingPileVisitor;
use IDock\Visitor\Premium\PremiumCoverageVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\Premium\PremiumUnderwritingVisitor;
use IDock\Visitor\VehicleModelVisitor;

/**
 * 询价
 */
class NonCarProductListRequest extends AllZSICRequest
{
    protected $response = NonCarProductListResponse::class;

    protected $urlTip = '非车产品列表获取';

    public $requestCode = 'getNonVehicleProducts';

    /**
     * @var NonCarProductListVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $this->channelCode = $this->visitor->argc['channelCode'] ?? '';

        $this->cityCode = $this->visitor->argc['cityCode'] ?? '';

        $arr = [
            'vehicle' => [
                'seat' => $this->visitor->seats,
                'businessType' => ZSICEnums::$useNatureCode[$this->visitor->useNatureCode] ?? '',
                'ownershipType' => ZSICEnums::$attachNature[$this->visitor->attachNature] ?? '',
                'vehicleCategory' => ZSICEnums::$carKindCode[$this->visitor->carKindCode] ?? '',
                'useType' => ZSICEnums::$causeType[$this->visitor->causeType] ?? '',
            ],
        ];
        $tong = $this->visitor->argc['tonnage'] ?? 0;
        if(!empty($tong)){
            $arr['vehicle']['tonnage'] = $tong;
        }
        return $arr;
    }

    public function getBusinessNo()
    {
        return $this->visitor->argc['businessNo'] ?? '';
    }

}
